package com.ruirenyun.controller;

import com.ruirenyun.entity.MobileUser;
import com.ruirenyun.service.MobileUserService;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 手机端用户表(MobileUser)表控制层
 *
 * @author makejava
 * @since 2021-04-20 11:47:10
 */
@RefreshScope
@RestController
@RequestMapping("/mobileUser")
public class MobileUserController {
    /**
     * 服务对象
     */
    @Resource
    private MobileUserService mobileUserService;

    /**
     * 获取所有用户
     * @return
     */
    @GetMapping("/getMobileUserList")
    public List<MobileUser> getMobileUserList(String keyword, int start, int size){
        return mobileUserService.getMobileUserList(keyword, start, size);
    }

    /**
     * 获取用户根据id
     * @param userId
     * @return
     */
    @GetMapping("/getMobileUserById")
    public MobileUser getMobileUserById(@RequestParam(value = "userId") Long userId){
        return mobileUserService.getMobileUserById(userId);
    }
}
